package exdate;

import java.util.Calendar;
import java.util.Date;

/**
 * @author: knowno
 * @create: 2025-09-15 09:25
 * @Version 1.0
 **/
public class TestCalendar {
    public static void main(String[] args) {
        Calendar instance = Calendar.getInstance();
        System.out.println(instance);
        //获取年
        int year = instance.get(Calendar.YEAR);
        System.out.println(year);
        //获取月
        int month = instance.get(Calendar.MONTH);
        System.out.println(month);
        //获取日
        int day = instance.get(Calendar.DAY_OF_MONTH);
        System.out.println(day);
        //获取时
        int hour = instance.get(Calendar.HOUR_OF_DAY);
        System.out.println(hour);
        //获取分
        int minute = instance.get(Calendar.MINUTE);
        System.out.println(minute);
        //获取秒
        int second = instance.get(Calendar.SECOND);
        System.out.println(second);

    }
}
